package com.fyi.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class User {

    private Integer userId;

    /*@Length(min = 8, max = 11, message = "账号ID格式错误")*/
    @NotNull(message = "ID账号不能为空")
    private Integer loginId;

    private String userName;
    @Pattern(regexp = "^.*(?=.{6,})(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$", message = "密码必须要有大小写字母，数字，和特殊符号")
    private String password;

    @Length(min = 11, max = 11, message = "手机号格式不正确")
    private String phone;

    @Email(regexp = "^([A-Za-z0-9_\\-\\.])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,4})$",message = "邮箱格式错误")
    private String eMail;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private String createUserTime;

    private List<Message> messageList;

}
